import collections
class Solution(object):
    def distinctNumbers(self, nums, k):
        c = collections.Counter(nums[:k])
        ans = [len(c)]
        n = len(nums)
        for i in range(n - k):
            c[nums[i + k]] += 1
            c[nums[i]] -= 1
            if not c[nums[i]]:
                c.pop(nums[i])
            ans.append(len(c))
        return ans